package indi.zhifa.recipe.bailan.framework.auth.controller.api;

import indi.zhifa.recipe.bailan.framework.auth.entity.annotations.PasswdEncode;
import indi.zhifa.recipe.bailan.framework.auth.service.ILoginService;
import indi.zhifa.recipe.bailan.framework.common.entity.annotations.UnLogin;
import indi.zhifa.recipe.bailan.framework.auth.entity.dto.user.LoginDto;
import indi.zhifa.recipe.bailan.framework.auth.entity.vo.BaseLoginInfoVo;
import indi.zhifa.recipe.bailan.framework.common.entity.annotations.ZfRestController;
import io.swagger.annotations.Api;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

@Api(tags = "LoginAip-登录接口")
@RequestMapping("/api/login")
@Slf4j
@ZfRestController
@RequiredArgsConstructor
public class LoginAip {

    private final ILoginService mLoginService;

    @PasswdEncode
    @UnLogin
    @Operation(summary = "登录")
    @PostMapping
    public BaseLoginInfoVo login(
            @Validated @Parameter(description = "登录信息") @RequestBody LoginDto pLoginDto){
        BaseLoginInfoVo baseLoginInfoVo = mLoginService.login(pLoginDto);
        return baseLoginInfoVo;
    }
}
